package com.ydc.ln.tutorial.gui.test.comp;

import java.awt.Color;
import java.awt.Container;
import java.awt.Font;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;

/**
 * 
 * @author ydc
 * @date 下午1:07:47 2013-5-19
 */
public class TabblePaneFrame extends JFrame {

    /**
     * @Fields serialVersionUID
     */
    private static final long serialVersionUID = -6600272328551012767L;

    public static void main(String[] args) {
        new TabblePaneFrame();
    }

    public TabblePaneFrame() {
        this.setTitle("TabbedPane Test");
        this.setSize(800, 600);
        this.setResizable(false);
        this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);


        // 组件声明
        Container c = this.getContentPane();
        JPanel jpMain = new JPanel();
        JTabbedPane jtp = new JTabbedPane();
        JPanel jp1 = new JPanel();
        JPanel jp2 = new JPanel();
        JTextArea jta1 = new JTextArea("textarea1");
        JTextArea jta2 = new JTextArea("textarea2");

        // 设置组件属性
        jta1.setEditable(false);
        jta1.setLineWrap(true);
        jta1.setSize(760, 600);
        jta1.setFont(new Font("楷体_GB2312", java.awt.Font.BOLD, 13));
        jta1.setForeground(Color.blue);

        jta2.setSize(760, 600);
        jta2.setEditable(false);
        jta2.setLineWrap(true);
        jta2.setFont(new Font("楷体_GB2312", java.awt.Font.BOLD, 13));
        jta2.setForeground(Color.black);

        jtp.setSize(800, 600);

        // 添加组件
        jp1.add(jta1);
        jp2.add(jta2);
        jtp.addTab("tab1", null, jp1, null);
        jtp.addTab("tab2", null, jp2, null);
        jpMain.add(jtp);
        c.add(jpMain);

        // this.pack();
        this.setVisible(true);
    }
}
